home *** CD-ROM | disk | FTP | other *** search
- Path: oxy.rust.net!usenet
- From: ebennett@rust.net
- Newsgroups: comp.lang.c
- Subject: Re: Q: realloc->free?
- Date: Wed, 17 Jan 1996 05:58:08 GMT
- Organization: Rust Net - High Speed Internet in Detroit 810-642-2276
- Message-ID: <4dhoig$ioj@oxy.rust.net>
- References: <4daa2e$oh5@axe.netdoor.com> <4df2ud$706@oxy.rust.net> <30fb133c.1128448@nntp.ix.netcom.com>
- NNTP-Posting-Host: liv-10.rust.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- miker3@ix.netcom.com (Mike Rubenstein) wrote:
-
- >ebennett@rust.net wrote:
-
- >|>esargent@netdoor.com (Eric Sargent) wrote:
- >|>
- >|>
- >|>
- > Stuff Deleted
- >|>realloc() will free the old block. It is perfectly legal to say
- >|>
- >|> a = realloc(a, newsize);
- >|>
- >|>No memory loss should occur from this.
-
- >What if realloc() fails? This will assign NULL to a and the old value
- >will be lost unless it's been stored in some other variable.
-
- An excellent point, sir! I have never had occasion to use realloc
- myself, and had not thought about the consequences. So, although
- legal to do as I said, it is admittedly foolish.
-
- Earl
-
-
-